Skip to content

Conversation

@ChengShi-1
Copy link
Contributor

@ChengShi-1 ChengShi-1 commented Jan 7, 2026

What this PR does / why we need it:

  • Use Cases of GET and DELETE a template
  • Restructure existing template related uses cases to /template folder

Which issue(s) this PR closes:

Related Dataverse PRs:

Special notes for your reviewer:

  • Mainly check on Use Cases of Get a template and Delete a template, (get dataset templates and create template was implemented before)
  • I ignored some Copilot review now, Copilot has some comments about the naming confusion between Template and Dataset Template. I tried to keep it calling Template instead of Dataset Template, besides getDatasetTemplates use case

Suggestions on how to test this:

Is there a release notes or changelog update needed for this change?:

YES

Additional documentation:

@ChengShi-1 ChengShi-1 linked an issue Jan 7, 2026 that may be closed by this pull request
@github-actions github-actions bot added FY26 Sprint 12 FY26 Sprint 12 (2025-12-03 - 2025-12-17) FY26 Sprint 13 FY26 Sprint 13 (2025-12-17 - 2025-12-31) FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) GREI Re-arch GREI re-architecture-related SPA.Q4.2025.1 Create/Edit Dataset Template Page labels Jan 7, 2026
@ChengShi-1 ChengShi-1 marked this pull request as ready for review January 8, 2026 00:18
Copilot AI review requested due to automatic review settings January 8, 2026 00:18
@ChengShi-1 ChengShi-1 moved this to Ready for Review ⏩ in IQSS Dataverse Project Jan 8, 2026
@ChengShi-1 ChengShi-1 added Size: 10 A percentage of a sprint. 7 hours. Original size: 10 labels Jan 8, 2026
@ChengShi-1 ChengShi-1 changed the title Use Cases of Add and Delete a template Use Cases of Get and Delete a template Jan 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures template-related functionality into a dedicated /templates module and adds new use cases for getting and deleting templates. The changes move template operations from the datasets and collections modules to a more appropriate domain-specific location.

Key Changes:

  • Created new Templates module with dedicated use cases: CreateTemplate, GetTemplate, GetDatasetTemplates, and DeleteTemplate
  • Migrated template functionality from datasets and collections modules to the new templates module
  • Added comprehensive unit, integration, and functional tests for the new template operations

Reviewed changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/templates/domain/useCases/GetTemplate.ts New use case for retrieving a single template by ID
src/templates/domain/useCases/DeleteTemplate.ts New use case for deleting a template by ID
src/templates/domain/useCases/CreateTemplate.ts Migrated and updated CreateTemplate use case from collections module
src/templates/domain/useCases/GetDatasetTemplates.ts Migrated use case for getting templates by collection
src/templates/domain/repositories/ITemplatesRepository.ts New repository interface defining template operations
src/templates/domain/models/Template.ts Updated template model definitions (renamed from DatasetTemplate)
src/templates/infra/repositories/TemplatesRepository.ts New repository implementation for template operations
src/templates/infra/repositories/transformers/templateTransformers.ts Transformer logic migrated from datasets module
src/templates/infra/repositories/transformers/TemplatePayload.ts Updated payload interface for templates
src/templates/index.ts Module exports for templates domain
src/index.ts Added templates module to main exports
test/unit/templates/*.test.ts New unit tests for template use cases
test/integration/templates/TemplateRepository.test.ts Comprehensive integration tests for template repository
test/functional/templates/createDatasetTemplate.test.ts Updated functional test with new import paths
src/datasets/domain/useCases/GetDatasetTemplates.ts Removed - migrated to templates module
src/datasets/infra/repositories/transformers/datasetTemplateTransformers.ts Removed - migrated to templates module
src/collections/domain/useCases/CreateDatasetTemplate.ts Removed - migrated to templates module
src/collections/infra/repositories/CollectionsRepository.ts Removed createDatasetTemplate method
docs/useCases.md Updated documentation with new Templates section and reorganized template use cases
CHANGELOG.md Updated with new template use cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { Template } from '../models/Template'

export interface ITemplatesRepository {
createDatasetTemplate(
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming inconsistency: The repository method is named createDatasetTemplate but the domain model is just Template (not DatasetTemplate). For consistency with the new template domain naming (where the model is Template and the use case is CreateTemplate), consider renaming this method to createTemplate.

Suggested change
createDatasetTemplate(
createTemplate(

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@ekraffmiller ekraffmiller Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this suggested change from createDatasetTemplate() to createTemplate() makes sense, given that the object is a Template, and now that the other method has changed to getTemplatesByCollectionId(). What do you think?

@IQSS IQSS deleted a comment from Copilot AI Jan 8, 2026
@IQSS IQSS deleted a comment from Copilot AI Jan 8, 2026
@ekraffmiller ekraffmiller self-assigned this Jan 9, 2026
@ekraffmiller ekraffmiller moved this from Ready for Review ⏩ to In Review 🔎 in IQSS Dataverse Project Jan 9, 2026
Copy link
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I just have some suggestions about the naming conventions

template: CreateDatasetTemplateDTO
): Promise<void>
getTemplate(templateId: number): Promise<Template>
getDatasetTemplates(collectionIdOrAlias: number | string): Promise<Template[]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The naming of the two get functions are a little confusing. At first glance, it seems like getDatasetTemplates() may be returning all Templates for a Dataset.
Instead of getDatasetTemplates(), can we change it to getTemplatesByCollectionId()? That way it is more clear what is being returned.

* Creates a Dataset Template in the specified collection.
* Creates a template in the specified collection.
*
* @param {CreateDatasetTemplateDTO} template - Template definition payload.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {CreateDatasetTemplateDTO} template - Template definition payload.
* @param {CreateTemplateDTO} template - Template definition payload.

@ChengShi-1 ChengShi-1 self-assigned this Jan 12, 2026
Copy link
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ChengShi-1 , thanks for the updates, I have a couple more comments, let me know what you think :)

import { Template } from '../models/Template'

export interface ITemplatesRepository {
createDatasetTemplate(
Copy link
Contributor

@ekraffmiller ekraffmiller Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this suggested change from createDatasetTemplate() to createTemplate() makes sense, given that the object is a Template, and now that the other method has changed to getTemplatesByCollectionId(). What do you think?

docs/useCases.md Outdated
- [Templates](#Templates)
- [Templates read use cases](#templates-read-use-cases)
- [Get a Template](#get-a-template)
- [Get Dataset Templates](#get-dataset-templates)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the useCase docs with the new function name

@ekraffmiller ekraffmiller removed their assignment Jan 13, 2026
@ChengShi-1
Copy link
Contributor Author

@ekraffmiller thanks for the suggestions, it makes sense to change to CreateTemplate, I’ve just updated it

Copy link
Contributor

@ekraffmiller ekraffmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! approved

@github-project-automation github-project-automation bot moved this from In Review 🔎 to Ready for QA ⏩ in IQSS Dataverse Project Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FY26 Sprint 12 FY26 Sprint 12 (2025-12-03 - 2025-12-17) FY26 Sprint 13 FY26 Sprint 13 (2025-12-17 - 2025-12-31) FY26 Sprint 14 FY26 Sprint 14 (2025-12-31 - 2026-01-14) GREI Re-arch GREI re-architecture-related Original size: 10 Size: 10 A percentage of a sprint. 7 hours. SPA.Q4.2025.1 Create/Edit Dataset Template Page

Projects

Status: Ready for QA ⏩

Development

Successfully merging this pull request may close these issues.

Use Cases of GET and DELETE a template

3 participants